<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>    
        var folder = ['a.txt',['b.txt',['c.txt']]]
        fileNumber(folder)
        function fileNumber(dir){
            var num = 0 
            dir.forEach(function(item){
                if(item instanceof Array){
                    num++
                }else{
                    num += fileNumber(item)
                }
            })
        }
    </script>
</body>
</html>